const express = require('express');
const router = express.Router();
const ChatController = require('../controllers/chat.controller');
const authMiddleware = require('../middlewares/auth.middleware');

// 所有聊天相关的路由都需要验证token
router.use(authMiddleware);

// 创建新会话
router.post('/sessions', ChatController.createSession);

// 获取所有会话
router.get('/sessions', ChatController.getSessions);

// 发送消息
router.post('/messages', ChatController.sendMessage);

// 获取会话历史消息
router.get('/sessions/:sessionId/messages', ChatController.getMessages);

// 重命名会话
router.put('/sessions/:sessionId/rename', ChatController.renameSession);

// 删除会话
router.delete('/sessions/:sessionId', ChatController.deleteSession);

module.exports = router; 